//
//  DXMLBoutObject.h
//  DerbyStatter
//
//  Created by glenn andreas on 1/6/14.
//  Copyright (c) 2014 glenn andreas. All rights reserved.
//

#import "DXMLObjectThing.h"
#import "DXMLImporter.h"
@class DXMLVenueObject;
@class DXMLRuleSetObject;
@class DXMLTeamObject;
@class DXMLPersonObject;
@class DXMLPeriodObject;
@interface DXMLBoutObject : DXMLObjectThing
@property (assign) BOOL sanctioned;
@property (strong) NSArray *periods;
@property (strong) NSArray *teams;
@property (strong) DXMLRuleSetObject *ruleSet;
//@property (strong) DXMLScoreboardSettingsObject *scoreboardSettings;
@property (strong) DXMLVenueObject *venue;
// derived
@property (readonly) DXMLTeamObject *homeTeam;
@property (readonly) DXMLTeamObject *awayTeam;
@property (readonly) DXMLPeriodObject *firstPeriod;
@property (readonly) DXMLPeriodObject *secondPeriod;
// utils
- (NSArray *) penaltiesForSkater: (DXMLPersonObject *) skater;
- (NSInteger) scoreForTeam: (DXMLTeamObject *) team;
// array of array pairs with enter/exit box events
- (NSArray *) boxTripsForSkater: (DXMLPersonObject *) skater;
+ (DXMLBoutObject *) defaultBout;
- (void) makeDefaultBout;
- (NSDate *) date; // based on "date" attribute, in WFTDA standard YYYY_MM_DD
@end


@interface DXMLObject(Bout)
- (DXMLBoutObject *) enclosingBout;
@end